using ERP.Common.Results;
using ERP.Team.ProductionSystem;
using ERP.ERPSystem.ProductionSystem.Dto;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;

namespace ERP.ERPSystem.ProductionSystem
{
    /// <summary>
    /// 物料需求服务接口
    /// </summary>
    public interface IMaterialRequirementServices : IApplicationService
    {
        /// <summary>
        /// 根据客户订单ID获取物料需求列表
        /// </summary>
        /// <param name="customerOrderId">客户订单ID</param>
        /// <returns>物料需求列表</returns>
        Task<List<MaterialRequirementModel>> GetMaterialRequirementsByOrderId(int customerOrderId);

        /// <summary>
        /// 分页查询物料需求列表
        /// </summary>
        /// <param name="queryDto">查询条件</param>
        /// <returns>分页物料需求列表</returns>
        Task<APIPaging<MaterialRequirementModel>> GetMaterialRequirementList(MaterialRequirementQueryDto queryDto);

        /// <summary>
        /// 根据ID获取物料需求详情
        /// </summary>
        /// <param name="id">需求ID</param>
        /// <returns>物料需求详情</returns>
        Task<MaterialRequirementModel> GetMaterialRequirementById(int id);

        /// <summary>
        /// 添加物料需求
        /// </summary>
        /// <param name="materialRequirementDto">物料需求信息</param>
        /// <returns>需求ID</returns>
        Task<int> AddMaterialRequirement(MaterialRequirementDto materialRequirementDto);

        /// <summary>
        /// 更新物料需求
        /// </summary>
        /// <param name="materialRequirementDto">物料需求信息</param>
        /// <returns>更新结果</returns>
        Task<bool> UpdateMaterialRequirement(MaterialRequirementDto materialRequirementDto);

        /// <summary>
        /// 批量保存物料需求（删除原有数据，重新保存）
        /// </summary>
        /// <param name="batchSaveDto">批量保存DTO</param>
        /// <returns>保存结果</returns>
        Task<bool> BatchSaveMaterialRequirements(BatchSaveMaterialRequirementDto batchSaveDto);

        /// <summary>
        /// 删除物料需求
        /// </summary>
        /// <param name="id">需求ID</param>
        /// <returns>删除结果</returns>
        Task<bool> DeleteMaterialRequirement(int id);

        /// <summary>
        /// 批量删除物料需求
        /// </summary>
        /// <param name="ids">需求ID数组</param>
        /// <returns>删除结果</returns>
        Task<bool> DeleteMaterialRequirements(int[] ids);

        /// <summary>
        /// 根据客户订单ID删除所有相关物料需求
        /// </summary>
        /// <param name="customerOrderId">客户订单ID</param>
        /// <returns>删除结果</returns>
        Task<bool> DeleteMaterialRequirementsByOrderId(int customerOrderId);

        /// <summary>
        /// 复制物料需求到另一个订单
        /// </summary>
        /// <param name="sourceOrderId">源订单ID</param>
        /// <param name="targetOrderId">目标订单ID</param>
        /// <returns>复制结果</returns>
        Task<bool> CopyMaterialRequirements(int sourceOrderId, int targetOrderId);

        /// <summary>
        /// 获取物料需求的树形结构数据
        /// </summary>
        /// <param name="customerOrderId">客户订单ID</param>
        /// <returns>树形结构的物料需求列表</returns>
        Task<List<MaterialRequirementDto>> GetMaterialRequirementTree(int customerOrderId);
    }
} 